home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / ConditionalMacros.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  6.8 KB  |  224 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ConditionalMacros.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __CONDITIONALMACROS__
  18. #define __CONDITIONALMACROS__
  19.  
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24.  
  25. #if GENERATINGPOWERPC
  26. #pragma options align=mac68k
  27. #endif
  28.  
  29. #ifdef __CFM68K__
  30. #pragma lib_export on
  31. #endif
  32.  
  33. /*
  34.     This file sets up the following compiler independent conditionals:
  35.     
  36.     GENERATINGPOWERPC        - Compiler is generating PowerPC instructions
  37.     GENERATING68K            - Compiler is generating 68k family instructions
  38.     GENERATING68881            - Compiler is generating mc68881 floating point instructions
  39.     GENERATINGCFM            - Code being generated assumes CFM calling conventions
  40.     CFMSYSTEMCALLS            - No A-traps.  Systems calls are made using CFM and UPP's
  41.     
  42.     SystemSevenFiveOrLater    - Compiled code will only be run on a System 7.5 or later Macintosh
  43.     SystemSevenOrLater        - Compiled code will only be run on a System 7.0 or later Macintosh
  44.     SystemSixOrLater        - Compiled code will only be run on a System 6.0 or later Macintosh
  45.                               A developer should set the appropriate flag on the compiler command-
  46.                               line or in a file processed before this file.  This will allow the
  47.                               certain optimizations to be made which can result in smaller, faster
  48.                               applications.
  49.     
  50.     CGLUESUPPORTED            - Interface library will support "C glue" functions (function names
  51.                               are: all lowercase, use C strings instead of pascal strings, use 
  52.                               Point* instead of Point).
  53.  
  54.     OLDROUTINENAMES            - "Old" names for Macintosh system calls are allowed in source code.
  55.                               (e.g. DisposPtr instead of DisposePtr). The names of system routine
  56.                               are now more sensitive to change because CFM binds by name.  In the 
  57.                               past, system routine names were compiled out to just an A-Trap.  
  58.                               Macros have been added that each map an old name to its new name.  
  59.                               This allows old routine names to be used in existing source files,
  60.                               but the macros only work if OLDROUTINENAMES is true.  This support
  61.                               will be removed in the near future.  Thus, all source code should 
  62.                               be changed to use the new names! You can set OLDROUTINENAMES to false
  63.                               to see if your code has any old names left in it.
  64.     
  65.     OLDROUTINELOCATIONS     - "Old" location of Macintosh system calls are used.  For example, c2pstr 
  66.                               has been moved from Strings to TextUtils.  It is conditionalized in
  67.                               Strings with OLDROUTINELOCATIONS and in TextUtils with !OLDROUTINELOCATIONS.
  68.                               This allows developers to upgrade to newer interface files without suddenly
  69.                               all their code not compiling becuase of "incorrect" includes.  But, it
  70.                               allows the slow migration of system calls to more understandable file
  71.                               locations.  OLDROUTINELOCATIONS currently defaults to true, but eventually
  72.                               will default to false.
  73.     
  74.     
  75.     There are some invariants among the conditionals:
  76.     
  77.     GENERATINGPOWERPC != GENERATING68K
  78.     GENERATING68881 => GENERATING68K
  79.     GENERATINGPOWERPC => GENERATINGCFM
  80.     GENERATINGPOWERPC => CFMSYSTEMCALLS
  81.     CFMSYSTEMCALLS => GENERATINGCFM
  82.     GENERATINGPOWERPC => SystemSevenOrLater
  83.     SystemSevenFiveOrLater => SystemSevenOrLater
  84.     SystemSevenOrLater => SystemSixOrLater
  85.     
  86.     
  87. */
  88. #ifdef GENERATINGPOWERPC
  89. #define GENERATING68K !GENERATINGPOWERPC
  90. #endif
  91. #ifdef GENERATING68K
  92. #define GENERATINGPOWERPC !GENERATING68K
  93. #endif
  94. #ifndef GENERATINGPOWERPC
  95.     #if defined(powerc) || defined(__powerc)
  96. #define GENERATINGPOWERPC 1
  97.     #else
  98. #define GENERATINGPOWERPC 0
  99.     #endif
  100. #endif
  101. #ifndef GENERATING68K
  102.     #if GENERATINGPOWERPC
  103. #define GENERATING68K 0
  104.     #else
  105. #define GENERATING68K 1
  106.     #endif
  107. #endif
  108. #if GENERATING68K
  109.     #if defined(applec) || defined(__SC__)
  110.         #ifdef mc68881
  111. #define GENERATING68881 1
  112.         #endif
  113.     #elif __MWERKS__
  114.         #if __MC68881__
  115. #define GENERATING68881 01
  116.         #endif
  117.     #endif
  118. #endif
  119. #ifndef CGLUESUPPORTED
  120.     #if defined(THINK_C) || (defined(__SC__) && !defined(__CFM68K__))
  121. #define CGLUESUPPORTED 0
  122.     #else
  123. #define CGLUESUPPORTED 1
  124.     #endif
  125. #endif
  126. #ifndef GENERATING68881
  127. #define GENERATING68881 0
  128. #endif
  129. #if GENERATINGPOWERPC
  130. #define CFMSYSTEMCALLS 1
  131. #define GENERATINGCFM 1
  132. #endif
  133. #ifndef GENERATINGCFM
  134.     #ifndef __CFM68K__
  135. #define GENERATINGCFM 0
  136. #define CFMSYSTEMCALLS 0
  137.     #else
  138. #define GENERATINGCFM 1
  139. #define CFMSYSTEMCALLS 1
  140.     #endif
  141. #endif
  142. #ifndef CFMSYSTEMCALLS
  143. #define CFMSYSTEMCALLS 0
  144. #endif
  145. #ifndef SystemSevenFiveOrLater
  146. #define SystemSevenFiveOrLater 0
  147. #endif
  148. #ifndef OLDROUTINENAMES
  149. #define OLDROUTINENAMES 1
  150. #endif
  151. #ifndef OLDROUTINELOCATIONS
  152. #define OLDROUTINELOCATIONS 1
  153. #endif
  154. #ifndef SystemSevenOrLater
  155.     #if GENERATINGCFM || SystemSevenFiveOrLater
  156. #define SystemSevenOrLater 1
  157.     #else
  158. #define SystemSevenOrLater 0
  159.     #endif
  160. #endif
  161. #ifndef SystemSixOrLater
  162. #define SystemSixOrLater SystemSevenOrLater
  163. #endif
  164. #if OLDROUTINENAMES 
  165.     #ifndef USES68KINLINES
  166. #define USES68KINLINES GENERATING68K
  167.     #endif
  168. #define USESCODEFRAGMENTS GENERATINGCFM
  169. #define USESROUTINEDESCRIPTORS GENERATINGCFM
  170. #endif
  171. #if CFMSYSTEMCALLS
  172. #define ONEWORDINLINE(trapNum)
  173. #define TWOWORDINLINE(w1, w2)
  174. #define THREEWORDINLINE(w1, w2, w3)
  175. #define FOURWORDINLINE(w1, w2, w3, w4)
  176. #define FIVEWORDINLINE(w1, w2, w3, w4, w5)
  177. #define SIXWORDINLINE(w1, w2, w3, w4, w5, w6)
  178. #define SEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7)
  179. #define EIGHTWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8)
  180. #define NINEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9)
  181. #define TENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10)
  182. #define ELEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11)
  183. #define TWELVEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12)
  184. #else
  185. #define ONEWORDINLINE(trapNum)     \
  186.     = trapNum
  187. #define TWOWORDINLINE(w1, w2)     \
  188.     = {w1,w2}
  189. #define THREEWORDINLINE(w1, w2, w3)  \
  190.     = {w1,w2,w3}
  191. #define FOURWORDINLINE(w1, w2, w3, w4)  \
  192.     = {w1,w2,w3,w4}
  193. #define FIVEWORDINLINE(w1, w2, w3, w4, w5)  \
  194.     = {w1,w2,w3,w4,w5}
  195. #define SIXWORDINLINE(w1, w2, w3, w4, w5, w6)  \
  196.     = {w1,w2,w3,w4,w5,w6}
  197. #define SEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7)  \
  198.     = {w1,w2,w3,w4,w5,w6,w7}
  199. #define EIGHTWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8)  \
  200.     = {w1,w2,w3,w4,w5,w6,w7,w8}
  201. #define NINEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9)  \
  202.     = {w1,w2,w3,w4,w5,w6,w7,w8,w9}
  203. #define TENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10)  \
  204.     = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10}
  205. #define ELEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11)  \
  206.     = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11}
  207. #define TWELVEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12)  \
  208.     = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12}
  209. #endif
  210.  
  211. #ifdef __CFM68K__
  212. #pragma lib_export off
  213. #endif
  214.  
  215. #if GENERATINGPOWERPC
  216. #pragma options align=reset
  217. #endif
  218.  
  219. #ifdef __cplusplus
  220. }
  221. #endif
  222.  
  223. #endif /* __CONDITIONALMACROS__ */
  224.